<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
		<style>
			* {
				padding: 0;
				margin: 0;
			}

			div {
				width: 300px;
				height: 35px;
				margin: 50px auto;
				border: 5px solid black;
			}


		</style>
	</head>
	<body>

		<div></div>
		<div></div>
		<div></div>
		<div></div>
		<div></div>
		<div></div>
		<div></div>
		<div></div>
		<div></div>
		<div></div>
		
	</body>
</html>
<script>
	
	// var divs = document.querySelectorAll('div');
	// [].slice.call(divs, 0, 5).forEach(function(ele, index) {
	// 	// console.log(ele, index);
	// 	ele.style.background = "red";
	// });


	var arr = {
		0: 1,
		1: 2,
		2: 3,
		3: 4,
		length: 4
	};
	console.log([].slice.call(arr));
	[].slice.call(arr).forEach(function(ele, index) {
		console.log(ele, index);
	});


	function slice() {
		var arr  = [];
		for (var i = 0; i < this.length; i++) {
			arr.push(this[i]);
		}
		return arr;
	}
	// console.log(slice.call(arr));
	// slice.call(arr).forEach(function(ele, index) {
	// 	console.log(ele, index);
	// });




</script>